﻿using Agro.Models;
using System.Data;
using SN.Core;
using SN.Data;
using System.Collections.Generic;
namespace Agro.Services
{

    public interface IRoleService : IBaseService
    {
        /// <summary>
        /// 保存角色
        /// </summary>
        /// <param name="role"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        bool SaveRole(T_Role role, out string msg);
        /// <summary>
        /// 删除角色
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        bool DeleteRoles(string ids, out string msg);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="query"></param>
        /// <param name="where"></param>
        /// <returns></returns>
        System.Data.DataTable GetRoleUsers(SN.Core.QueryBase query, string id, int CurrUserOrganization_ID);
        /// <summary>
        /// 获取未分配角色的用户列表
        /// </summary>
        /// <param name="id"></param>
        /// <param name="CurrUserOrganization_ID"></param>
        /// <returns></returns>
        System.Data.DataTable GetUserNotInRole(SN.Core.QueryBase query,string id, int CurrUserOrganization_ID);
        
        /// <summary>
        /// 保存角色的菜单权限
        /// </summary>
        /// <param name="roleId"></param>
        /// <param name="menuIds"></param>
        /// <returns></returns>
        string SaveRoleMenus(int roleId, string menuIds);
        /// <summary>
        /// 保存角色用户
        /// </summary>
        /// <param name="roleId"></param>
        /// <param name="userIds"></param>
        /// <returns></returns>
        string SaveRoleUsers(string roleId, string userIds);

        /// <summary>
        /// 移除角色里的用户
        /// </summary>
        /// <param name="roldId"></param>
        /// <param name="UserId"></param>
        /// <returns></returns>
        string RemoveRoleUser(string roleId, string UserId);

        /// <summary>
        /// 获取用户的角色列表
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        IList<T_Role> GetUserRoleList(int userId);

        void SaveRoleActions(int roleId, int menuId, string actionIds);
    }
}
